using System;
using System.Data;
using Sanelib.DataOperation;
using Sanelib.DataOperation.Attribute;
using Sanelib.DataOperation.Base;

namespace Core.Domain.Model
{
    [EntityName("TrackLog")]
    public class TrackLog : AuditedEntity
    {
        public string Code { get; set; }
        public DateTime? DetectedOn { get; set; }

        public override void From(IDataReader dataReader)
        {
            base.From(dataReader);
            Code = dataReader.ReadNullSafeString("Code");
            DetectedOn = dataReader.ReadNullSafeDateTime("DetectedOn");
        }

        public override void To(System.Data.SqlClient.SqlCommand cmd)
        {
            base.To(cmd);
            cmd.Parameters.Add("@Code", SqlDbType.NVarChar).Value = Code;
            cmd.Parameters.Add("@DetectedOn", SqlDbType.DateTime).Value = DetectedOn;
        }
    }
}
